package sz.szsmk.citizencard.model.network.bean;

import android.os.Bundle;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * author : hyt
 * date : 2020/1/7
 * description :
 */
public class JumpActivityEventBusBean implements Serializable {

    // bundle 是 参数  便于直接传入activity
//        "{
//	       "code": "这里是eventbus里面的code",
//	       "bundle": [{
//		              "key": "value"
//	                }]
//         }"

    //为什么是map  因为 每个activity的 需要的参数名称 不一样

    private int code;
    private List<Map<String,String>> bundle;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<Map<String, String>> getBundle() {
        return bundle;
    }

    public void setBundle(List<Map<String, String>> bundle) {
        this.bundle = bundle;
    }

    public Bundle getBundles(){
        Bundle newBundle = new Bundle();
        if(bundle!=null && bundle.size()>0){
            for(Map<String,String> temp : bundle){
                Set<String> keySet = temp.keySet();
                //遍历存放所有key的Set集合
                Iterator<String> it =keySet.iterator();
                while(it.hasNext()){
                    String key = it.next();
                    String value = temp.get(key);
                    newBundle.putString(key,value);
                }
            }
            return newBundle ;
        }else{
            return newBundle ;
        }
    }
}